#include <iostream>

#include <boost/numeric/conversion/cast.hpp>

void some_function(unsigned short param)
{
	std::cout << "param:" << param << "    " << std::endl;
}

void correct_implementation() {
	some_function(
		boost::numeric_cast<unsigned short>(100)
	);
	some_function(
		boost::numeric_cast<unsigned short>(1000000)
	);
}

int main()
{
	try {
		correct_implementation();
	}
	catch (const boost::numeric::bad_numeric_cast & e) {
		std::cout << e.what() << std::endl;
	}
	return 0;
}